package cn.sxt.yxl.question.service.tset;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;

import cn.sxt.common.util.BaseTest;
import cn.sxt.common.util.ConstantFinalUtil;
import cn.sxt.yxl.question.pojo.AColumns;
import cn.sxt.yxl.question.pojo.AColumnsEnum;
import cn.sxt.yxl.question.service.IQuestionService;
import cn.sxt.yxl.users.pojo.ARole;

public class QuestionServiceTest  extends BaseTest{

	private IQuestionService questionService;
	@Before
	public void init(){
		super.init();
		this.questionService = (IQuestionService) ac.getBean("questionService");
	}
	/**
	 * 查询一条栏目信息
	 */
	@Test
	public void findOne(){
		Map<String, Object> condMap = new HashMap<String, Object>();
		condMap.put("id", 1);
		AColumns admin = questionService.findOneAdminService(condMap);
		ConstantFinalUtil.LOGGER.info("id:{},email:{},creatTime:{}",admin.getId(),
				admin.getName(),admin.getCreateTime().toLocaleString());
	}
	
	/**
	 * 查询多条栏目信息
	 */
	@Test
	public void findCondList(){
		Map<String, Object> condMap = new HashMap<String, Object>();
		condMap.put("status", AColumnsEnum.STATUS_ENABLE.getStatus());
		List<AColumns> columnsList = this.questionService.findCondAdminListService(null, condMap);
		for (Iterator iterator = columnsList.iterator(); iterator.hasNext();) {
			AColumns columns = (AColumns) iterator.next();
			ConstantFinalUtil.LOGGER.info("name:{}",columns.getName());
		}
	}
}
